package com.qcby.controller;

import com.qcby.entity.Clazz;
import com.qcby.entity.Result;
import com.qcby.entity.Student;
import com.qcby.service.ClazzService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "班级接口")
@RestController
@RequestMapping("/class")
public class ClazzController {
    @Autowired
    private ClazzService clazzService;
    @ApiModelProperty("获取所有班级")
    @GetMapping("/list")
    public Result list(Student student){
        System.out.println(student);
        return Result.success(clazzService.list(student));
    }

    @ApiOperation(value = "查询班级信息")
    @PostMapping("/SearchLesson")
    @ResponseBody
    public Result SearchLesson(Clazz clazz) {
        return Result.success(clazzService.SearchLesson(clazz));
    }


    @ApiOperation(value = "添加班级")
    @PostMapping("/AddLesson")
    @ResponseBody
    public Result AddLesson(Clazz clazz) {

        return Result.success(clazzService.AddLesson(clazz));
    }


    @ApiOperation(value = "修改班级信息")
    @PostMapping("/UpdateLesson")
    @ResponseBody
    public Result UpdateLesson(Clazz clazz) {

        return Result.success(clazzService.UpdateLesson(clazz));
    }


    @ApiOperation(value = "删除班级信息")
    @PostMapping("/DeleteLesson")
    @ResponseBody
    @ApiImplicitParams({
            @ApiImplicitParam(value = "id",name = "id" ,dataType = "Integer")
    })
    public Result DeleteLesson(Integer id) {

        return Result.success(clazzService.DeleteLesson(id));
    }
}
